<#function compare oldValue newValue>
  <#if oldValue == newValue><#return "same"/></#if>
  <#if oldValue lt newValue><#return "worse"/></#if>
  <#if oldValue gt newValue><#return "better"/></#if>
</#function>
<#macro sourceLink url text="" baseUrl="">
  <#if text?has_content>
    <#if baseUrl?has_content>
        <a href="${baseUrl?replace('{path}', url)}">${text}</a>
      <#else/>
        ${text}
    </#if>
  <#else/>
    &nbsp;
  </#if>
</#macro>
<#macro oldSourceLink url text="">
  <@sourceLink url text oldSourceUrl/>
</#macro>
<#macro newSourceLink url text="">
  <@sourceLink url text newSourceUrl/>
</#macro>
<html>
  <head>
    <title>Testability Diff</title>
    <style type="text/css">
      .better {
        background-color: lightgreen;
      }
      .worse {
        background-color: pink;
      }
      .same {
        background-color: white;
      }
      .summary {
        border: thin solid #000000;
        width: 100%;
        margin-bottom: 2em;
      }
      .method {
        font-size: 12px;
      }
      .class {
        font-size: 14px;
      }
      .class,.method {
        font-family: monospace;
      }
      .indent {
        padding-left: 1.5em;
      }
      .header td {
        font-weight: bold;
        border-top: 1em solid white;
      }
    </style>
  </head>
  <body>
    <center><h1>Testability Diff Report</h1></center>
    <center>(Generated on: ${currentTime?datetime})</center>



    <table class="summary">
      <thead><th>Class Summary</th><th>Old</th><th>New</th><th>&Delta;</th></thead>
      <#list classDiffs as classDiff>
        <tr class="${compare(classDiff.oldMetric!0,classDiff.newMetric!0)} class">
          <td>
            <a href="#${classDiff.className?html}">${classDiff.className}</a>
          </td>
          <td><@oldSourceLink classDiff.className?html classDiff.oldMetric /></td>
          <td><@newSourceLink classDiff.className?html classDiff.newMetric /></td>
          <td>${classDiff.delta}</td>
        </tr>
      </#list>
    </table>


    <table class="summary">
      <thead><th colspan="2">Class Detail</th><th>Old</th><th>New</th><th>&Delta;</th></thead>
      <#list classDiffs as classDiff>  
        <tr class="${compare(classDiff.oldMetric!0,classDiff.newMetric!0)} header">
          <td colspan="2" class="class">
            <a name="${classDiff.className?html}"/> ${classDiff.className}
          </td>
          <td><@oldSourceLink classDiff.className?html classDiff.oldMetric /></td>
          <td><@newSourceLink classDiff.className?html classDiff.newMetric /></td>
          <td>${classDiff.delta}</td>
        </tr>
        <#list classDiff.methodDiffs as methodDiff>
          <tr class="${compare(methodDiff.oldMetric!0, methodDiff.newMetric!0)} method">
            <td class="indent same"></td>
            <td>${methodDiff.methodName}</td>
            <td>${methodDiff.oldMetric!}</td>
            <td>${methodDiff.newMetric!}</td>
            <td>${methodDiff.delta}</td>
          </tr>
        </#list>
      </#list>
    </table>

  </body>
</html>